<?php
class Aviso extends AppModel {

	var $name = 'Aviso';
	var $validate = array(
		//'fecha' => array('date'),
		'titulo' => array('rule'=>'notempty', 'message'=>'Titulo es un campo obligatorio'),
		'contenido' => array('notempty'),
		'ciclo_id' => array('numeric'),
		'usuario_id' => array('numeric')
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Ciclo' => array(
			'className' => 'Ciclo',
			'foreignKey' => 'ciclo_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Usuario' => array(
			'className' => 'Usuario',
			'foreignKey' => 'usuario_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
	
	function findByCiclo($ciclo = null)
	{
		return $this->find('all', array('conditions' => array('Aviso.ciclo_id' => $ciclo)));
	}

}
?>